package procsim;

import java.awt.*;

public class PaintDISP extends PaintTab {
    public PaintDISP(Paint parent) {
        super(parent);
        // Coordinates
        Design.zero8.addCoords(this, 192, 30, 192, 60);
        Design.ff8.addCoords(this, 241, 30, 241, 60);
        Design.IR23.addCoords(this, Design.DISPAND1.getLower2Coords(25));
        Design.BNZ.addCoords(this, Design.DISPAND1.getUpper2Coords(25));
        Design.DISPAND1out.addCoords(this, Design.DISPAND1.getResCoords(20));
        Design.DISPAND1out.addCoords(this, 340, 82, 340, 102);
        Design.DISPAND1out.addCoords(this, Design.DISPOR1.getLower2Coords(13));
        Design.IR15.addCoords(this, Design.DISPAND2.getLower2Coords(25));
        Design.L3.addCoords(this, Design.DISPAND2.getUpper2Coords(20));
        Design.DISPAND2out.addCoords(this, Design.DISPAND2.getResCoords(20));
        Design.DISPAND2out.addCoords(this, 340, 117, 340, 132);
        Design.DISPAND2out.addCoords(this, Design.DISPOR1.getUpper2Coords(13));
        Design.DISPOR1out.addCoords(this, Design.DISPOR1.getResCoords(20));
        Design.DISPMP1out.addCoords(this, Design.DISPMP1.getResCoords(30));
        Design.DISPMP1out.addCoords(this, 217, 190, 367, 190);
        Design.DISPMP1out.addCoords(this, 367, 190, 367, 204);
        Design.IR15_8.addCoords(this, 512, 15, 512, 60);
        Design.IR23_16.addCoords(this, 561, 30, 561, 60);
        Design.BNZ.addCoords(this, 630, 110, 600, 110);
        Design.DISPMP2out.addCoords(this, Design.DISPMP2.getResCoords(30));
        Design.DISPMP2out.addCoords(this, 537, 190, 377, 190);
        Design.DISPMP2out.addCoords(this, 377, 190, 377, 204);
        Design.DISPMP3in.addCoords(this, 372, 210, 372, 240);
        Design.zero16.addCoords(this, 421, 210, 421, 240);
        Design.regind.addCoords(this, Design.DISPOR3.getLower2Coords(30));
        Design.mem.addCoords(this, Design.DISPOR3.getUpper2Coords(25));
        Design.DISPOR3out.addCoords(this, Design.DISPOR3.getResCoords(20));
        Design.DISPMP3out.addCoords(this, Design.DISPMP3.getResCoords(30));
        Design.REGout.addCoords(this, 55, 210, 93, 210);
        Design.REGout.addCoords(this, 93, 210, 93, 240);
        Design.PCout.addCoords(this, 123, 180, 123, 240);
        Design.IR15_0.addCoords(this, 153, 210, 153, 240);
        Design.rel.addCoords(this, Design.DISPOR2.getLower2Coords(20));
        Design.BNZ.addCoords(this, Design.DISPOR2.getUpper2Coords(20));
        Design.DISPOR2out.addCoords(this, Design.DISPOR2.getResCoords(20));
        Design.mem.addCoords(this, 230, 305, 200, 305);
        Design.DISPMP4out.addCoords(this, Design.DISPMP4.getResCoords(30));
        Design.DISPMP4out.addCoords(this, 137, 370, 225, 370);
        Design.DISPMP4out.addCoords(this, Design.DISPADD.getInACoords(30));
        Design.DISPMP3out.addCoords(this, 397, 370, 305, 370);
        Design.DISPMP3out.addCoords(this, Design.DISPADD.getInBCoords(30));
        Design.DISPout.addCoords(this, Design.DISPADD.getResCoords(30));
        Design.DISPout.addCoords(this, 265, 490, 420, 490);
        Design.DISPout.addCoords(this, 420, 490, 420, 370);
        Design.DISPout.addCoords(this, 420, 370, 515, 370);
        Design.DISPout.addCoords(this, Design.TEMPDISP.getInCoords(30));
        Design.ldTD.addCoords(this, Design.TEMPDISP.getLdCoords(25));
        Design.TEMPDISPout.addCoords(this, Design.TEMPDISP.getOutCoords(30));

        // Collections
        elements.add(Design.DISPMP1);
        elements.add(Design.DISPMP2);
        elements.add(Design.DISPMP3);
        elements.add(Design.DISPMP4);
        elements.add(Design.DISPADD);
        elements.add(Design.DISPAND1);
        elements.add(Design.DISPAND2);
        elements.add(Design.DISPOR1);
        elements.add(Design.DISPOR2);
        elements.add(Design.DISPOR3);
        elements.add(Design.TEMPDISP);

        lines.add(Design.zero8);
        lines.add(Design.ff8);
        lines.add(Design.zero16);
        lines.add(Design.IR23_16);
        lines.add(Design.IR15_8);
        lines.add(Design.REGout);
        lines.add(Design.PCout);
        lines.add(Design.TEMPout);
        lines.add(Design.DISPout);
        lines.add(Design.L3);
        lines.add(Design.BNZ);
        lines.add(Design.regind);
        lines.add(Design.mem);
        lines.add(Design.rel);
        lines.add(Design.DISPMP1out);
        lines.add(Design.DISPMP2out);
        lines.add(Design.DISPMP3in);
        lines.add(Design.DISPMP3out);
        lines.add(Design.DISPMP4out);
        lines.add(Design.IR15_0);
        lines.add(Design.IR15);
        lines.add(Design.IR23);
        lines.add(Design.DISPOR1out);
        lines.add(Design.DISPOR2out);
        lines.add(Design.DISPOR3out);
        lines.add(Design.DISPAND1out);
        lines.add(Design.DISPAND2out);
        lines.add(Design.TEMPDISPout);
        lines.add(Design.ldTD);
    }
    @Override
    public void paint(Graphics g){
        super.paint(g);
        Graphics2D gnew = (Graphics2D)g;
        Util.saveGraphics(gnew);
        gnew.setColor(Color.GRAY);
        gnew.setStroke(new BasicStroke(2));
        // grouping signals
        gnew.drawLine(360, 203, 360, 205); // |
        gnew.drawLine(360, 205, 370, 205); // -
        gnew.drawLine(370, 205, 372, 207); // \
        gnew.drawLine(372, 207, 374, 205); // /
        gnew.drawLine(374, 205, 384, 205); // -
        gnew.drawLine(384, 205, 384, 203); // |
        Util.restoreGraphics(gnew);
    }
}
